var t = require("../../../@babel/runtime/helpers/interopRequireDefault").default,
  e = require("../../../utils/http"),
  a = t(require("../../../utils/util")),
  n = new e.HTTP;
Page({
  data: {
    hfsj: a.default.formatDate(new Date),
    currentDate: (new Date).getTime(),
    minDate: new Date(a.default.formatnow(new Date)).getTime(),
    formatter: function (t, e) {
      return "year" === t ? "".concat(e, "年") : "month" === t ? "".concat(e, "月") : e
    },
    preventTouchMove: function (t) {},
    show: !1
  },
  onConfirm: function (t) {
    var e = a.default.formatStamp(t.detail);
    this.setData({
      show: !1,
      hfsj: e
    })
  },
  onCancel: function () {
    this.setData({
      show: !1
    })
  },
  quxiao: function () {
    wx.navigateBack({
      delta: 1
    })
  },
  opentime: function () {
    this.setData({
      show: !0
    })
  },
  selectEvent: function (t) {
    this.setData({
      sortType: t.detail.selectedID,
      nowText: t.detail.nowText
    })
  },
  formSubmit: function (t) {
    var e = this,
      o = t.detail.value;
    wx.showModal({
      title: "提示",
      content: "请确认是否提交",
      success: function (t) {
        o.genjin && null != e.data.nowText ? n.request({
          url: "https://www.qlsyyun.com:3030/record/qdwhjl",
          header: {
            "Content-Type": "application/x-www-form-urlencoded"
          },
          method: "POST",
          data: {
            qymc: e.data.total.qymc,
            bm: e.data.name[1],
            khbh: e.data.total.id,
            qdid: e.data.total.qdid,
            whry: o.whryname,
            whsj: e.data.hfsj,
            lxr: e.data.nowText,
            whlr: o.genjin,
            whname: e.data.name[0]
          }
        }).then((function (t) {
          n.request({
              url: "https://www.qlsyyun.com:3030/record/stjd",
              header: {
                "Content-Type": "application/x-www-form-urlencoded"
              },
              method: "POST",
              data: {
                khbh: e.data.total.id,
                qymc: e.data.total.qymc,
                bm: e.data.name[1],
                tname: e.data.name[0]
              }
            }).then((function (t) {})),
            n.request({
              url: "https://www.qlsyyun.com:3030/record/stmx",
              header: {
                "Content-Type": "application/x-www-form-urlencoded"
              },
              method: "POST",
              data: {
                khbh: e.data.total.id,
                qymc: e.data.total.qymc,
                cid: e.data.total.qdid,
                time: a.default.formatTime(new Date).substring(0, 10),
                tname: e.data.name[0]
              }
            }).then((function (t) {})),
            wx.showToast({
              title: "添加成功",
              icon: "success",
              duration: 1e3,
              success: function () {
                setTimeout((function () {
                  wx.navigateBack({
                    delta: 1
                  })
                }), 1e3)
              }
            })
        })) : wx.showToast({
          title: "请检查是否有必填项未填",
          icon: "none",
          duration: 1e3
        })
      }
    })
  },
  onLoad: function (t) {
    var e = this,
      a = wx.getStorageSync("user");
    n.request({
      url: "https://www.qlsyyun.com:3030/channel",
      data: {
        arr: 4,
        id: t.id
      }
    }).then((function (n) {
      e.setData({
        selectArray: n.data,
        name: a,
        total: t
      })
    }))
  }
});